Input Devices

Goal

Make a device that will give me a light indicator of when the music is too loud from our building. MIT policy states that music cannot be audible from outside. The sensor would be placed outside and the light would be placed inside.

Materials and software

  1. Fusion 360
  2. Eagle for circuit design (in Fusion)
  3. Circuit board bill
  4. MIC MEMS ANALOG OMNI -22DB
  5. Xiao RP2040
  6. Female and male jumper cables and pins
  7. Hot Glue

Fusion Work

  1. Need to make a simple board with surface mounted mic to connect to the xiao rp2040
  2. I read the datasheet wrong the first time and did not have the right design
  3. Additionally, I thought I could just not connect gain and ignore it, but in testing the board gave no responsivness
  4. Redesigned board in order to have the option to connect gain depending on which 0 ohm resistor I soldered
arrangment
Paper mock up
table
Updated board

Circuit board mill

  1. This part was pretty straight forward except for trying to put the right bit in the machine
  2. It constantly switched on me and I had to keep changing it and then it would use the 1/64th bit for 2 seconds
  3. If you're confused on what bit it is just grab a caliper and measure the bit
  4. I learned how to start the board drilling in a different spot than the bottom left by changing the origin
pieces
Circuit board mill used

Soldering

  1. Because the mic was surface mounted I needed to learn how to solder with a hot air gun
  2. This includes a hot air gun and a paste
  3. You want to get a decent dot on all of your components because the solder shrinks considerably
  4. I ended up liking this method a lot more than soldering by hand which took longer and more frsutration
  5. I also learned theres a desoldering pinchers which will snip off the soldered component easily
  6. *************
  7. Separately I left my board in my backpack and pins broke so I had to hot glue female connectors to the board
  8. This ended up being ok because my pinout for the board I was reusing WAS NOT COMPATIBLE WITH ANALOG so I had to jump a couple pins
  9. Additionally I learned that I connected gain to a pin when it did not need to be but thankfully it did not break anything and just used the out
  10. ********
  11. Also learned more about capacitors and frequency units cause I had to calculate the size of capacitor based off the datasheet equation.
  12. cutting
    Heat tray
    Final
    Solder paste
    Final
    Jerry rigged test board

Analyzing Signals

  1. I have never deal with analog signals before so I had to learn how to mess with them
  2. To me I was just receiving a ton of random numbers from the pin and it oscilated extremely randomly
  3. Part of the reason this happens is how often you sample and whether or not you filter the signal
  4. Given that I am not a signal processing expert I just used a simple filter to average the last 10 values
  5. After that I played with the average threshold and sampling frequency to get the right values for the EECS Lab
  6. I eventually was able to get an led to start blinking when I blasted music from my speaker next to it but sitll needs tuning
  7. cutting
    New wired board plus tuning
    Final
    Signals post filtering
        
            import machine
            from machine import Pin
            from utime import sleep
            
            # Define the ADC (Analog-to-Digital Converter) object for pin 29
            gain = machine.ADC(Pin(29))
            
            # Define the filter parameters
            filter_length = 10  # Number of samples to average
            filtered_values = [0] * filter_length
            
            # Define the LED on pin 26
            led = machine.Pin(26, machine.Pin.OUT)
            
            # Set the sound level threshold
            sound_threshold = 19600  # Adjust as needed
            
            while True:
                # Read the analog value from pin 29
                analog_value_gain = gain.read_u16()
            
                # Add the current reading to the filter buffer
                filtered_values.pop(0)
                filtered_values.append(analog_value_gain)
            
                # Calculate the average of the filtered values
                filtered_value_avg = sum(filtered_values) / filter_length
            
                # Print the filtered analog value to the console
                print("Filtered analog value on pin 29:", filtered_value_avg)
            
                # Check if the filtered value is above the sound threshold
                if filtered_value_avg > sound_threshold:
                    # Turn on the LED on pin 26
                    led.on()
                else:
                    # Turn off the LED on pin 26
                    led.off()
                
                sleep(0.1)
            
        
        

Conclusions

  1. Started seeing what signal processing is like
  2. Learned how to use solder paste
  3. Understood that grabbing sensor and slapping it on board is not as straightforward as it seems. Well maybe not it will be hopefully
  4. Don't put your precious board in your backpack
  5. If you put jumpter cable make sure they are short and not long and dangling
  6. Make boards for different data sheets is slowly getting more familiar
  7. Group project link Group Assignment